package com.itjiange.reglg.exception;

import com.itjiange.reglg.common.ErrorCode;

/**
 * 自定义业务异常
 *
 * @author ItJiange
 * @date 2023/11/13
 */
public class BussinessException extends RuntimeException {
    private final int code; // 错误码

    public BussinessException(ErrorCode errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }

    public BussinessException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public BussinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public int getCode() {
        return this.code;
    }
}
